<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
  <title th:text="${result.data.company.name}+' - 公司主页'">求职防坑 - 公司主页</title>
  <meta name="keywords" th:content="${result.data.company.name}+',求职防坑,公司怎么样,公司点评,看公司评价的网站,应届生求职网,公司点评'"/>
  <meta name="description" th:content="${result.data.company.description}"/>
  <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
        integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
        crossorigin="anonymous"/>
  <link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet"/>
  <link rel="stylesheet" type="text/css" th:href="@{/css/common.css}"/>
  <link rel="stylesheet" type="text/css" th:href="@{/css/detail.css}"/>
</head>

<body>
<div class="container">
  <div class="row">
    <div class="black_content">
      <div class="header">
        <span class="glyphicon glyphicon-knight"></span>
        <div class="create_link_div pull-right">
          <a th:href="@{/companies/create}" class="create_link" target="_blank">增加公司</a>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="container">
  <div class="row">
    <div class="nav_area">
      <div class="nav_area_content">
        <div class="nav_area_content_info">
          <a href="/">首页</a>
          <span>> 公司详情</span>
        </div>
        <strong th:text="${result.data.company.name}"></strong>
      </div>
    </div>
  </div>
</div>

<div class="container">
  <div class="row">
    <div class="comments">
      <div class="comments_left pull-left">
        <h4 th:text="${result.data.company.description}">……
        </h4>
        <div class="main_comments">
          <div class="comment_opt" onclick="showDialog(0)">
            <i class="fa fa-commenting-o" aria-hidden="true">我来点评</i>
          </div>
          <div class="clearfix"></div>
        </div>
        <div class="comments_area">
          <div class="commentType" th:each="comment : ${result.data.comments}">
            <div class="comment_icon pull-left">
              <i th:class="${comment.type}==1 ? 'fa fa-thumbs-up green' : 'fa fa-thumbs-down red'"
                 aria-hidden="true"></i>
            </div>
            <div class="comment_txt pull-left">
              <p th:text="${comment.content}">…</p>
              <div>
                <div class="pull-left"
                     th:text="${#dates.format(comment.createTime,'yyyy-MM-dd HH:mm:ss')}">
                  2017-12-12 15:33:33
                </div>
                <div class="pull-right">
                  <div class="comment_opt" th:text="${comment.diggCount}"><i class="fa fa-thumbs-up"
                                                                             aria-hidden="true"></i>
                    12
                  </div>
                  <div class="comment_opt" th:onclick="'showDialog('+${comment.id}+',\'\')'"><i
                      class="fa fa-commenting-o"
                      aria-hidden="true"> 回复</i>
                  </div>
                </div>
              </div>
            </div>
            <div class="clearfix"></div>
            <div class="comment_child" th:each="childComment : ${comment.childs}">
              <p th:text="${childComment.content}">…</p>
              <div class="">
                <div class="pull-left"
                     th:text="${#dates.format(childComment.createTime,'yyyy-MM-dd HH:mm:ss')}">
                  2017-12-12 15:33:33
                </div>
                <div class="pull-right">
                  <div class="comment_opt"
                       th:onclick="'showDialog('+${comment.id}+',\''+${childComment.content}+'\')'">
                    <i
                        class="fa fa-commenting-o" aria-hidden="true"> 回复</i>
                  </div>
                </div>
              </div>
              <div class="clearfix">
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="comments_right pull-right">
        <div class="ad_content">
          敬请期待
        </div>
      </div>
      <div class="clearfix"></div>
    </div>
  </div>
</div>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <form th:action="@{'/companies/'+${result.data.company.id}+'/comment'}" th:method="post">
        <input type="hidden" id="parentId" name="parentId"/>
        <input type="hidden" name="type" id="commentType" value="0"/>

        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
              aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="myModalLabel">回复评论</h4>
        </div>
        <div class="modal-body">
          <section id="Phase1">
                            <textarea class="ContactUsInput" placeholder="说点啥"
                                      style="height:200px;" name="content"
                                      onfocus="this.placeholder = ''"
                                      id="content"
                                      onblur="this.placeholder = '说点啥'"></textarea>
          </section>
        </div>
        <div class="modal-footer">
          <div id="commentButtonContainer">
            <button type="submit" class="btn btn-danger" onclick="saveComment(0)">
              <i class="fa fa-thumbs-down red" aria-hidden="true"></i>
              差评
            </button>
            <button type="submit" class="btn btn-success" onclick="saveComment(1)">
              <i class="fa fa-thumbs-up green" aria-hidden="true"></i>
              好评
            </button>
          </div>
          <button type="submit" id="childCommentButton" class="btn btn-success"
                  onclick="saveComment(0)">
            回复
          </button>
        </div>
      </form>
    </div>
  </div>
</div>

<script>
  function showDialog(commentId, parentContent) {
    $("input#parentId").val(commentId);

    if (parentContent) {
      $("textarea#content").val("@" + parentContent + "// ");
      $("input#parentId").val(commentId);
    } else {
      $("textarea#content").val("");
    }

    var commentButtonContainer = document.getElementById("commentButtonContainer");
    var childCommentButton = document.getElementById("childCommentButton");
    if (commentId) {
      childCommentButton.style.display = "";
      commentButtonContainer.style.display = "none";
    } else {
      childCommentButton.style.display = "none";
      commentButtonContainer.style.display = "";
    }
    $("#myModal").modal();
  }

  function saveComment(type) {
    $("input#commentType").val(type);
    $("#myModal").modal('hide');
  }
</script>

<script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<!-- Analytics
   ================================================== -->
<script>
  var _hmt = _hmt || [];
  (function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?8e5779def54689dfeb863aea23ad0397";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
</script>
<script>
  (function () {
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
      bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
      bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
  })();
</script>
</body>
</html>